'use strict';

const Service = require('egg').Service;

class HomeService extends Service {
    async index(size, count) {
        const { app } = this;
        // const con = await app.mysql.select('list',{
        //     // where:{id:23378},
        //     limit:size (size * count)
        //   });
        const con = await app.mysql.query('select * from list limit ? , ?', [(size - 1) * count, count])
        const total = await app.mysql.query('select count(*) from list')
        const data = {
            total: total[0]['count(*)'],
            con: con,
        }
        // con.push({total:total[0]['count(*)']})
        return data
    }
    async details(id) {
        const { app } = this;
        const data = await app.mysql.select('list', {
            where: { id: id },
        });

        return data
    }



}

module.exports = HomeService;
